package com.example.android.story.Utils;

import android.arch.lifecycle.LiveData;
import android.arch.persistence.room.Dao;
import android.arch.persistence.room.Delete;
import android.arch.persistence.room.Insert;
import android.arch.persistence.room.Query;

/**
 * Created by liwei on 2018/6/10.
 */

@Dao
public interface RememberMeDao {
    @Insert
    public void insert(RememberMe rememberMe);

    @Query("select * from _user where username=:username")
    public User getUser(String username);

    @Query("select username,password,coins,salt from _user,_rememberMe where _user.username=_rememberMe.name")
    public LiveData<User> getRememberMe();

    @Query("delete from _rememberMe")
    public void erase();
}
